Model fit

Column

Assumption checks

Column

Indices of model fit

Metric Value
AIC 1186.39
AICc 1187.08
BIC 1208.43
R2 (cond.) 0.66
R2 (marg.) 0.21
ICC 0.57
RMSE 4.72
Sigma 5.62

For interpretation of performance metrics, please refer to this documentation.

Parameter estimates

Column

Plot

Column

Tabular summary

# Fixed Effects
Parameter Coefficient SE 95% CI t(165) p
(Intercept) 64.44 1.42 (61.64, 67.24) 45.43 < .001
poradie vysetrenia [M3] 2.09 1.39 (-0.64, 4.83) 1.51 0.133
poradie vysetrenia [M6] 5.13 1.16 (2.84, 7.43) 4.42 < .001
poradie vysetrenia [M18] 7.93 1.42 (5.13, 10.74) 5.58 < .001
var indep value 2.61e-03 7.76e-04 (1.07e-03, 4.14e-03) 3.36 < .001
# Random Effects
Parameter Coefficient
SD (Intercept: projekt_id) 6.42
SD (Residual) 5.62

To find out more about table summary options, please refer to this documentation.

Predicted Values

Column

Plot

Package `marginaleffects` required for this function to work.
package 'marginaleffects' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\baloun\AppData\Local\Temp\RtmpwbFD5u\downloaded_packages

Column

Tabular summary

Estimated Marginal Means
poradie_vysetrenia Mean SE 95% CI t(165)
M0 68.47 1.13 (66.23, 70.71) 60.43
M3 70.56 1.36 (67.87, 73.26) 51.74
M6 73.60 1.16 (71.31, 75.90) 63.39
M18 76.40 1.41 (73.62, 79.18) 54.26

Variable predicted: var_dep_value; Predictors modulated: poradie_vysetrenia; Predictors averaged: var_indep_value (1.5e+03), projekt_id

Estimated Marginal Means
var_indep_value Mean SE 95% CI t(165)
147.62 68.62 1.46 (65.73, 71.50) 46.97
963.33 70.74 1.07 (68.63, 72.85) 66.19
1779.03 72.87 0.98 (70.94, 74.80) 74.64
2594.73 75.00 1.25 (72.53, 77.47) 59.93
3410.43 77.12 1.73 (73.71, 80.53) 44.67
4226.13 79.25 2.28 (74.75, 83.75) 34.76
5041.83 81.38 2.87 (75.72, 87.04) 28.39
5857.53 83.51 3.47 (76.65, 90.36) 24.07
6673.23 85.63 4.08 (77.57, 93.69) 20.98
7488.93 87.76 4.70 (78.48, 97.04) 18.67

Variable predicted: var_dep_value; Predictors modulated: var_indep_value; Predictors averaged: poradie_vysetrenia, projekt_id

Text reports

Column

Textual summary

Something did not work as expected. Please file an issue at https://github.com/easystats/easystats/issues/ and post the following output:

Unable to refit the model with standardized data. Try instead to standardize the data (standardize(data)) and refit the model manually. Something did not work as expected. Please file an issue at https://github.com/easystats/easystats/issues/ and post the following output:

Unable to refit the model with standardized data. Try instead to standardize the data (standardize(data)) and refit the model manually.

Column

Model information

---
title: "Regression model summary from `{easystats}`"
output:
  flexdashboard::flex_dashboard:
    theme:
      version: 4
      # bg: "#101010"
      # fg: "#FDF7F7"
      primary: "#0054AD"
      base_font:
        google: Prompt
      code_font:
        google: JetBrains Mono
params:
  model: model
  check_model_args: check_model_args
  parameters_args: parameters_args
  performance_args: performance_args
---

```{r setup, include=FALSE}
library(flexdashboard)
library(easystats)

# Since not all regression model are supported across all packages, make the
# dashboard chunks more fault-tolerant. E.g. a model might be supported in
# `{parameters}`, but not in `{report}`.
#
# For this reason, `error = TRUE`
knitr::opts_chunk$set(
  error = TRUE,
  out.width = "100%"
)

# helper function for printing `{report}` outputs
bracket_to_parantheses <- function(text) {
  gsub("]", ")", gsub("[", "(", text, fixed = TRUE), fixed = TRUE)
}
```

```{r easydashboard-1}
# Get user-specified model data
model <- params$model

# Is it supported by `{easystats}`? Skip evaluation of the following chunks if not.
is_supported <- insight::is_model_supported(model)

if (!is_supported) {
  unsupported_message <- sprintf(
    "Unfortunately, objects of class `%s` are not yet supported in {easystats}.\n
    For a list of supported models, see `insight::supported_models()`.",
    class(model)[1]
  )
}
```


Model fit
=====================================

Column {data-width=700}
-----------------------------------------------------------------------

### Assumption checks

```{r check-model, eval=is_supported, fig.height=10, fig.width=10}
check_model_args <- c(list(model), params$check_model_args)
# add verbose, if not done yet
if (is.null(check_model_args$verbose)) check_model_args$verbose <- FALSE
tryCatch(
  {
    do.call(performance::check_model, check_model_args)
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
  }
)
```

```{r easydashboard-2, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=300}
-----------------------------------------------------------------------

### Indices of model fit

```{r easydashboard-3, eval=is_supported}
# {performance}
performance_args <- c(list(model), params$performance_args)
# add verbose, if not done yet
if (is.null(performance_args$verbose)) performance_args$verbose <- FALSE
table_performance <- do.call(performance::performance, performance_args)
print_md(table_performance, layout = "vertical", caption = NULL)
```


```{r easydashboard-4, eval=!is_supported}
cat(unsupported_message)
```

For interpretation of performance metrics, please refer to <a href="https://easystats.github.io/performance/reference/model_performance.html" target="_blank">this documentation</a>.

Parameter estimates
=====================================

Column {data-width=550}
-----------------------------------------------------------------------

### Plot

```{r dot-whisker, eval=is_supported}
# `{parameters}`
parameters_args <- c(list(model), params$parameters_args)
# add verbose, if not done yet
if (is.null(parameters_args$verbose)) parameters_args$verbose <- FALSE
table_parameters <- do.call(parameters::parameters, parameters_args)

plot(table_parameters)
```


```{r easydashboard-5, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=450}
-----------------------------------------------------------------------

### Tabular summary

```{r easydashboard-6, eval=is_supported}
print_md(table_parameters, caption = NULL)
```


```{r easydashboard-7, eval=!is_supported}
cat(unsupported_message)
```

To find out more about table summary options, please refer to <a href="https://easystats.github.io/parameters/reference/model_parameters.html" target="_blank">this documentation</a>.


Predicted Values
=====================================

Column {data-width=600}
-----------------------------------------------------------------------

### Plot

```{r expected-values, eval=is_supported, fig.height=10, fig.width=10}
# {modelbased}
int_terms <- find_interactions(model, component = "conditional", flatten = TRUE)
con_terms <- find_variables(model)$conditional

if (is.null(int_terms)) {
  model_terms <- con_terms
} else {
  model_terms <- clean_names(int_terms)
  int_terms <- unique(unlist(strsplit(clean_names(int_terms), ":", fixed = TRUE)))
  model_terms <- c(model_terms, setdiff(con_terms, int_terms))
}

# check some exceptions here: logistic regression models with factor response
# usually require the response to be included in the model, else `get_modelmatrix()`
# fails, which is required to compute SE/CI for `get_predicted()`
response <- find_response(model)
minfo <- model_info(model)
model_data <- get_data(model)
include_response <- minfo$is_binomial && minfo$is_logit && is.factor(model_data[[response]])

text_modelbased <- tryCatch(
  {
    lapply(unique(model_terms), function(i) {
      estimate_means(model, by = i, verbose = FALSE)
    })
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
    NULL
  }
)

if (!is.null(text_modelbased)) {
  ggplot2::theme_set(theme_modern())
  # all_plots <- lapply(text_modelbased, function(i) {
  #   out <- do.call(visualisation_recipe, c(list(i), modelbased_args))
  #   plot(out) + ggplot2::ggtitle("")
  # })
  all_plots <- lapply(text_modelbased, function(i) {
    out <- visualisation_recipe(i, show_data = FALSE)
    plot(out) + ggplot2::ggtitle("")
  })

  see::plots(all_plots, n_columns = round(sqrt(length(text_modelbased))))
}
```


```{r easydashboard-8, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=400}
-----------------------------------------------------------------------

### Tabular summary

```{r easydashboard-9, eval=is_supported, results="asis"}
if (!is.null(text_modelbased)) {
  for (i in text_modelbased) {
    tmp <- print_md(i)
    tmp[length(tmp)] <- paste(insight::compact_character(strsplit(tmp[length(tmp)], "\n")[[1]]), collapse = "; ")
    print(tmp)
  }
}
```


```{r easydashboard-10, eval=!is_supported}
cat(unsupported_message)
```


Text reports
=====================================

Column {data-width=500}
-----------------------------------------------------------------------

### Textual summary

```{r easydashboard-11, eval=is_supported, results='asis', collapse=TRUE}
# {report}
text_report <- tryCatch(
  {
    report(model, verbose = FALSE)
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
    NULL
  }
)


text_report_performance <- tryCatch(
  {
    report_performance(model, verbose = FALSE)
  },
  error = function(e) {
    cat(insight::format_message(
      "\nSomething did not work as expected. Please file an issue at {.url https://github.com/easystats/easystats/issues/} and post the following output:",
      paste0("\n`", e$message, "`")
    ))
    NULL
  }
)

if (!is.null(text_report)) {
  cat(bracket_to_parantheses(text_report))
  cat("\n")
}

if (!is.null(text_report_performance)) {
  cat(bracket_to_parantheses(text_report_performance))
}
```


```{r easydashboard-12, eval=!is_supported}
cat(unsupported_message)
```

Column {data-width=500}
-----------------------------------------------------------------------

### Model information

```{r easydashboard-13, eval=is_supported}
model_info_data <- insight::model_info(model, verbose = FALSE)
model_info_data <- datawizard::data_to_long(as.data.frame(insight::compact_list(model_info_data)))

DT::datatable(model_info_data)
```

```{r easydashboard-14, eval=!is_supported}
cat(unsupported_message)
```